#include <iostream>
using namespace std;

template <class T>
class Stack {
private:
    T* stackPtr;
    int top;
    int size;
public:
    Stack(int size); 
#if 0
    Stack(int size = 10) 
    {
        this->size = size;
        stackPtr = new T[size];
        top = -1;
    }
#endif 
    ~Stack()
    {
        delete []stackPtr;
    }
    int is_empty()
    {
        return top == -1;
    }
    int is_full()
    {
        return top == size - 1;
    }
    void push(T data)
    {
        if(!is_full())
        {
            stackPtr[++top] = data;
        }
    }
    void  pop(T& data)
    {
        if(!is_empty())
        {
            data = stackPtr[top--];
        }
    }
};
template <class T>
Stack<T>::Stack(int size)
{
    this->size = size;
    stackPtr = new T[size];
    top = -1;
}

int main()
{
    Stack<int> s(10);
    int i;

    for (i = 0; i < 10; i++)
    {
        s.push(i);
    } 

    while (!s.is_empty())
    {
        int data;
        s.pop(data);
        cout << data << " ";
    }
      
    cout << endl;

    Stack<double> s2(10);

    for (i = 0; i < 10; i++)
    {
        s2.push(i+0.5);
    } 
  
    while (!s2.is_empty())
    {
        double data;
        s2.pop(data);
        cout << data << " ";
    }
    cout << endl;
    //增加一个注释
	//在window中更改

	//删除
	//add a line
	//add a line two

    change in master
    after merge

    add a new line
    return 0;
}
